<template>
    <div>
        <!-- ----------- 严晴---------- -->
        <div class="addCustomers">
            <h3 class="lh">新增客户</h3>
            <el-form
                :label-position="labelPosition"
                label-width="80px"
                :model="formLabelAlign"
            >
                <el-form-item label="账号">
                    <el-input v-model="formLabelAlign.username"></el-input>
                </el-form-item>
                <el-form-item label="密码">
                    <el-input v-model="formLabelAlign.password"></el-input>
                </el-form-item>
                <el-form-item label="联系方式">
                    <el-input v-model="formLabelAlign.phone"></el-input>
                </el-form-item>
                <el-form-item label="姓名">
                    <el-input v-model="formLabelAlign.name"></el-input>
                </el-form-item>
                <el-form-item label="年龄">
                    <el-input v-model="formLabelAlign.age"></el-input>
                </el-form-item>
                <el-form-item label="性别">
                    <el-input v-model="formLabelAlign.gender"></el-input>
                </el-form-item>
                <el-form-item label="身份证">
                    <el-input v-model="formLabelAlign.IDCard"></el-input>
                </el-form-item>
            </el-form>
            <div class="lh">
                <el-button type="success" @click="addCustomer(formLabelAlign)"
                    >确认添加</el-button
                >
            </div>
        </div>
    </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
var { mapActions } = createNamespacedHelpers("customers");
export default {
    data() {
        return {
            labelPosition: "right",
            formLabelAlign: {
                username: "",
                password: "",
                phone: "",
                name: "",
                age: "",
                gender: "",
                IDCard: "",
                belongToSales: localStorage.getItem("_id"),
            },
        };
    },
    methods: {
        ...mapActions(["addCustomer"]),
    },
};
</script>

<style lang=scss>
.addCustomers {
    background-color: #fff;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}
.lh {
    line-height: 50px;
}
.addCustomers .el-form {
    width: 600px;
    text-align: center;
    margin: 0px auto;
}
</style>